package com.ssn.state.game;

public class Primary extends Level{

    public Primary(Game game) {
        this.score = 0;
        this.game = game;
        this.name = "入门级";
    }
    public Primary(Level level){
        this.game = level.game;
        this.score = level.score;
        this.name = "入门级";
    }

    @Override
    public void win() {
        this.score += 10;
        checkLevel(this.score);

        System.out.println("现在积分为 ： " + this.score);
        System.out.println("现在等级为 ： " + this.game.getLevel().name);
    }

    @Override
    public void checkLevel(int score) {
        if (score >= 100){
            game.setLevel(new Final(this));
        }else if(score >= 70){
            game.setLevel(new Professional(this));
        }else if(score >= 40){
            game.setLevel(new Secondary(this));
        }
    }

    @Override
    public void loose() {
        this.score -= 5;
        checkLevel(this.score);
        System.out.println("现在积分为 ： " + this.score);
        System.out.println("现在等级为 ： " + this.game.getLevel().name);
    }

    @Override
    public void play() {
        System.out.println("入门级play");
    }

    @Override
    public void doubleScore() {
        System.out.println("入门级无双倍积分");
    }

    @Override
    public void changeCards() {
        System.out.println("入门级无改变卡特权");
    }

    @Override
    public void peekCards() {
        System.out.println("入门级无看牌特权");
    }
}
